package com.edu.exam.entity.assessment;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.Builder.Default;

import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Column;
import jakarta.persistence.Version;
import java.math.BigDecimal;
import java.time.LocalDateTime;

import com.edu.exam.enums.assessment.SchemeStatus;

/**
 * 考核方案实体类
 *
 * 根据B-04考核方案管理模块设计文档实现
 * 管理课程考核方案的完整信息，包括方案基本信息、状态管理、审核流程等。
 *
 * @author System
 * @version 1.0.0
 */

@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class AssessmentPlanScheme {

    /**
     * 主键ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 方案编码，系统唯一标识
     */
    @Column(name = "code", nullable = false, length = 50, unique = true)
    private String code;

    /**
     * 方案名称
     */
    @Column(name = "name", nullable = false, length = 200)
    private String name;

    /**
     * 方案描述
     */
    @Column(name = "description", columnDefinition = "TEXT")
    private String description;

    /**
     * 关联课程ID
     */
    @Column(name = "course_id", nullable = false)
    private Long courseId;

    /**
     * 课程编码
     */
    @Column(name = "course_code", length = 50)
    private String courseCode;

    /**
     * 课程名称
     */
    @Column(name = "course_name", length = 200)
    private String courseName;

    /**
     * 方案状态
     */
    @Enumerated(EnumType.STRING)
    @Column(name = "status", nullable = false, length = 20)
    private SchemeStatus status;

    /**
     * 总分
     */
    @Column(name = "total_score", precision = 8, scale = 2)
    private BigDecimal totalScore;

    /**
     * 及格分
     */
    @Column(name = "passing_score", precision = 8, scale = 2)
    private BigDecimal passingScore;

    /**
     * 优秀分
     */
    @Column(name = "excellent_score", precision = 8, scale = 2)
    private BigDecimal excellentScore;

    /**
     * 学期
     */
    @Column(name = "semester", length = 20)
    private String semester;

    /**
     * 学年
     */
    @Column(name = "academic_year", length = 10)
    private String academicYear;

    /**
     * 适用专业
     */
    @Column(name = "applicable_majors", length = 500)
    private String applicableMajors;

    /**
     * 适用班级
     */
    @Column(name = "applicable_classes", length = 500)
    private String applicableClasses;

    /**
     * 考核目标
     */
    @Column(name = "assessment_objectives", columnDefinition = "TEXT")
    private String assessmentObjectives;

    /**
     * 考核内容
     */
    @Column(name = "assessment_content", columnDefinition = "TEXT")
    private String assessmentContent;

    /**
     * 实施要求
     */
    @Column(name = "implementation_requirements", columnDefinition = "TEXT")
    private String implementationRequirements;

    /**
     * 备注
     */
    @Column(name = "remarks", length = 1000)
    private String remarks;

    /**
     * 创建者ID
     */
    @Column(name = "creator_id", nullable = false)
    private Long creatorId;

    /**
     * 创建者姓名
     */
    @Column(name = "creator_name", nullable = false, length = 100)
    private String creatorName;

    /**
     * 创建时间
     */
    @Column(name = "create_time", nullable = false)
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @Column(name = "update_time")
    private LocalDateTime updateTime;

    /**
     * 版本号（用于乐观锁）
     */
    @Version
    @Column(name = "version", nullable = false)
    private Long version;

    /**
     * 是否删除
     */
    @Default
    @Column(name = "is_deleted", nullable = false)
    private Boolean isDeleted = false;

    /**
     * 删除时间
     */
    @Column(name = "deleted_time")
    private LocalDateTime deletedTime;

    /**
     * 删除者ID
     */
    @Column(name = "deleter_id")
    private Long deleterId;

}